/*jslint browser: true, nomen: true, es5: true*/
/*global $, jQuery, window, requirejs, require, define*/
(function (factory) {
    "use strict";
	if (typeof define === "function" && define.amd) {
		// AMD. Register as an anonymous module.
		define("lhmcv.config", factory);
	} else {
        // Browser globals
        window.lhmcv = window.lhmcv || {};
		window.lhmcv.config = factory();
	}
}(function () {
    "use strict";
    var config;
    config = {
        "debug": false,
        "waitime": 5,
        "syncUrl": '/sync/{record_id}/',
        "userUrl": '/auth/myself/',
        "db": {
            "DB_NAME": 'project-system-indexeddb',
            "DB_VERSION": 1
        },
        "url": {
            '^/iauth/$': "iauth.IUser",
            '^/project/$': "project.Project",
            '^/project/([0-9]+)/$': "project.Project",
            '^/project/component/$': "project.Component",
            '^/project/component/([0-9]+)/$': "project.Component",
            '^/project/pay/$': "project.Pay",
            '^/project/pay/([0-9]+)/$': "project.Pay",
            '^/auth/myself/$': "iauth.IUser"
        },
        "local": {
            "irecord.IRecord": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }]
                ],
                format: {
                    "pk": "int",
                    "author_id": "int",
                    "datestamp": "int",
                    "action": "string",
                    "model": "string"
                }
            },
            "iauth.IUser": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record", "record_id", {unique: false}]
                ],
                format: {
                    "pk": "int",
                    //AbstractUser
                    "username": "string",
                    "first_name": "string",
                    "last_name": "string",
                    "email": "string",
                    //self define
                    "record_id": "int",
                    "name_id": "int"
                }
            },
            "school.Level": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self-define
                    "startday": "int",
                    "enday": "int",
                    "name": "string"
                }
            },
            "school.Category": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self-define
                    "startday": "int",
                    "enday": "int",
                    "name": "string"
                }
            },
            "school.Staff": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self-define
                    "startday": "int",
                    "enday": "int",
                    "name": "string"
                }
            },
            "school.Department": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self_define
                    "father_id": "int",
                    "is_post": "int",
                    "startday": "int",
                    "enday": "int",
                    "name": "string",
                    "detail": "string"
                }
            },
            "staff.Staff": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    "startday": "int",
                    "enday": "int",
                    "name": "string",
                    //self define
                    "staff_id": "int",
                    "level_id": "int",
                    "category_id": "int"
                }
            },
            "project.Level": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self-define
                    "startday": "int",
                    "enday": "int",
                    "name": "string"
                }
            },
            "project.Project": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["valid_pk", ["is_delete", "pk"], { unique: false }],
                    ["valid_number", ["is_delete", "number"], { unique: false }],
                    ["valid_year", ["is_delete", "year"], { unique: false }],
                    ["all_valid_data", ["is_delete", "startday", "enday"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self define
                    "level_id": "int",
                    "is_stop": "int",
                    "year": "int",
                    "startday": "int",
                    "enday": "int",
                    "money": "int",
                    "source": "string",
                    "number": "string",
                    "author": "string",
                    "author_num": "int",
                    "name": "string",
                    //relationship
                    "staff_relation_list": "[{staff_id:1, index:1},]"
                }
            },
            "project.ToStaff": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["project_id", "project_id", { unique: false }],
                    ["staff_id", "staff_id", { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self define
                    "staff_id": "int",
                    "project_id": "int",
                    "index": "int"
                }
            },
            "project.Component": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["project_id", ["is_delete", "project_id"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self define
                    "project_id": "int",
                    "father_id": "int",
                    "is_payable": "int",
                    "money_all": "float",
                    "money_cost": "float",
                    "name": "string"
                }
            },
            "project.Pay": {
                keyPath: "pk",
                index_arg_list: [
                    ["pk", "pk", { unique: true }],
                    ["record_id", "record_id", { unique: false }],
                    ["project_id",  ["is_delete", "project_id"], { unique: false }],
                    ["component_id",  ["is_delete", "component_id"], { unique: false }]
                ],
                format: {
                    "pk": "int",
                    "record_id": "int",
                    "is_delete": "int",
                    //self define
                    "project_id": "int",
                    "component_id": "int",
                    "hander_id": "int",
                    "opor_id": "int",
                    "balance_id": "int",
                    "is_balance": "int",
                    "action_time": "int",
                    "money": "float",
                    "detail": "string"
                }
            }
        }
    };
    return config;
}));